package com.zyf.school.manager.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zyf.school.manager.dao.StaffDao;
import com.zyf.school.manager.domain.Staff;
import com.zyf.school.manager.service.StaffService;
import com.zyf.school.manager.util.RandomNum;
import com.zyf.school.manager.util.TimeStamp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StaffServiceImpl extends ServiceImpl<StaffDao,Staff> implements StaffService {
    @Autowired
    StaffDao staffDao;
    @Override
    public void insert(Staff staff) {
        //设置编号以及随机数
        staff.setId(staff.getId()+"-"+ TimeStamp.getStamp()+"-"+ RandomNum.get4Num());
        staffDao.insert(staff);
    }

    @Override
    public List<Staff> getStaffsByTel(String tel) {
        return staffDao.queryById(tel);
    }

    @Override
    public List<Staff> getStaffsByName(String name) {
        return staffDao.queryByName(name);
    }
}
